package org.snusmumr.android.media;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class Main extends TabActivity {
    private TabHost mTabHost;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Resources res = getResources();
        mTabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, CategoryTab.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = mTabHost.newTabSpec("categories").setIndicator(res.getText(R.string.tab_categories),
                          res.getDrawable(android.R.drawable.ic_menu_agenda))
                      .setContent(intent);
        mTabHost.addTab(spec);

        // initialize Labels tab
        intent = new Intent().setClass(this, LabelTab.class);
        spec = mTabHost.newTabSpec("labels").setIndicator(res.getText(R.string.tab_labels),
                          res.getDrawable(android.R.drawable.ic_input_get))
                      .setContent(intent);
        mTabHost.addTab(spec);
        
        // initialize lent items tab
        intent = new Intent().setClass(this, LentItemsTab.class);
        spec = mTabHost.newTabSpec("lent").setIndicator(res.getText(R.string.tab_lent_items),
                          res.getDrawable(android.R.drawable.btn_star))
                      .setContent(intent);
        mTabHost.addTab(spec);

        intent = new Intent().setClass(this, SearchTab.class);
        spec = mTabHost.newTabSpec("search").setIndicator(res.getText(R.string.tab_search),
                          res.getDrawable(android.R.drawable.ic_menu_search))
                      .setContent(intent);
        mTabHost.addTab(spec);
        
        intent = new Intent().setClass(this, WishListTab.class);
        spec = mTabHost.newTabSpec("search").setIndicator(res.getText(R.string.tab_wishlist),
                          res.getDrawable(android.R.drawable.btn_star))
                      .setContent(intent);
        mTabHost.addTab(spec);
        
        mTabHost.setCurrentTab(0);
    }
}